def monetki(n, money):
    for i in reversed(sorted(money)):
        if n - i * 2 in money:
            return f"{i} {i} {n - i * 2}"

if __name__ == "__main__":
    n, m = map(int, input().split())
    money = list(map(int, input().split()))
    print(monetki(n, money))
